package captcha

import (
	servicesSystem "admin_template/bff/admin/internal/service/system"
	"crypto/sha256"
	"fmt"
	hertzMiddleware "gitee.com/byx_darwin/go-tools/hertz/middleware"
	"github.com/cloudwego/hertz/pkg/app/middlewares/server/recovery"
	"github.com/cloudwego/hertz/pkg/app/server"
)

func Register(server *server.Hertz, api *servicesSystem.CaptchaService) {
	captchaGroup := server.Group(fmt.Sprintf("/%s/system/captcha", api.Config.ServerOption.Registry.Version))
	captchaGroup.Use(recovery.Recovery(recovery.WithRecoveryHandler(api.RecoveryHandler)))
	captchaGroup.Use(hertzMiddleware.Auth(api, sha256.New))
	{
		captchaGroup.GET("", api.Get)
	}

}
